package com.cndw.kungfu.model.goods.app;

import java.util.Map;

import com.cndw.kungfu.config.ConstantsLevel;
import com.cndw.kungfu.exception.ErrPopException;
import com.cndw.kungfu.ext.LanguageLib;
import com.cndw.kungfu.ext.StringProcesser;

/**
 * 使用获得冰魄
 * 
 * @author fantadust [9677889@qq.com]
 * @date 2012-8-22 下午9:16:12
 */
public class AppDo121 extends AppBase {

	@Override
	public boolean check() throws Exception {
		if (player.getLevel() < ConstantsLevel.lv60act) {
			throw new ErrPopException(LanguageLib.get("comm.err.level", ConstantsLevel.lv60act));
		}
		if (!player.getDataInfo().getArtifactByInit(true).isIdle()) {
			throw new ErrPopException(LanguageLib.get("goods.use.actfull"));

		}

		return true;
	}

	@Override
	public Map<String, Object> run() throws Exception {

		int bagId =player.getDataInfo().getArtifact().bagAdd(goodsMode.getValueA());

		player.getDataInfo().commitSync();
		
		int[] node = player.getDataInfo().getArtifact().getNodeByBag(bagId);
		if (node != null) {
			logString = StringProcesser.toString(node);
		}
		
		//ticpString = LanguageLib.get("goods.use.suc");
		
		return msg;
	}

}
